package com.lannuokeji.biz.ac.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.lannuokeji.biz.ac.entity.User;

/**
 * <p>
 * 用户信息表 Mapper 接口
 * </p>
 *
 * @author lannuoTeck
 * @since 2018-03-17
 */
public interface UserMapper extends BaseMapper<User> {
	/**
	 * 用户登录
	 * @param id
	 * @param password
	 * @return
	 */
	User login(@Param("id") String id, @Param("password") String password);
	
	@Update("update g_ac_user set password=#{repassword} where id=#{id} and password=#{password}")
	boolean updatePassword(@Param("id") String id,@Param("password") String password,@Param("repassword") String repassword);
	
	@Update("update g_ac_user set status = 4 where id=#{id}")
	boolean del(@Param("id") String id);
	
	User getUserInfo(@Param("id") String id);
	
	@Update("update g_ac_user set email=#{email}, phone=#{phone} where id=#{id}")
	boolean updateUserInfo(@Param("id") String id,@Param("email") String email,@Param("phone") String phone);
	
    List<User> page(Pagination page, @Param("entity")User user);

    @Update("update g_ac_user set status=#{status}, back=#{back} where id=#{id}")
	boolean check(@Param("id") String id,@Param("status") Integer status,@Param("back") String back);

    @Update("update g_ac_user set status=#{status} where id=#{id}")
	boolean invalidLogin(@Param("id") String id, @Param("status") Integer status);

    @Update("update g_ac_user set blackList=#{blackList} where id=#{id}")
	boolean blackList(@Param("id") String id, @Param("blackList") Integer blackList);

    @Update("update g_ac_user set roleId=#{roleId} where id=#{id}")
	boolean updateUserAction(@Param("id") String id, @Param("roleId") Integer roleId);
}
